#ifndef __DRVSD_H
#define __DRVSD_H

#include <stdint.h>
#include <stdbool.h>

typedef enum {
    SD_CTRL_READ = 0,
    SD_CTRL_WRITE,
    SD_CTRL_MAX
}SD_CTRL_E;

typedef enum {
    SD_DECT_UNEXIST = 0,
    SD_DECT_PLUG,
    SD_DECT_EXIST,
    SD_DECT_UNPLUG,
    SD_DECT_MAX
}SD_DECT_E;

typedef void (*SDSemCtrlFun)(SD_CTRL_E, bool);

uint8_t drvSDDectInit(void);
uint8_t drvSDInit(SDSemCtrlFun ctrl);
void drvSDDeInit(void);
SD_DECT_E drvSDDetected(void);
uint8_t drvSDReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
uint8_t drvSDWriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
uint8_t drvSDErase(uint32_t StartAddr, uint32_t EndAddr);
uint8_t drvSDGetCardState(void);

#endif //__DRVSD_H
